package cn.itguy.mobileguard;

import android.content.Context;
import android.hardware.Sensor;

public class SensorHelper {

	public enum SensorSensitivity{
		LOW, MIDDLE, HIGH
	}
	
	/**
	 * translate sensor to Chinese language by type.
	 * @param type
	 * @return
	 */
	public static String translateSensor(int type, Context context) {
		StringBuffer name = new StringBuffer("");
		switch (type) {
		case Sensor.TYPE_ACCELEROMETER:
			name.append(context.getString(R.string.sensor_accelerometer));
			break;
//		case Sensor.TYPE_GRAVITY:
//			name.append(context.getString(R.string.sensor_gravity));
//			break;
		case Sensor.TYPE_GYROSCOPE:
			name.append(context.getString(R.string.sensor_gyroscope));
			break;
		case Sensor.TYPE_LIGHT:
			name.append(context.getString(R.string.sensor_light));
			break;
//		case Sensor.TYPE_LINEAR_ACCELERATION:
//			name.append(context.getString(R.string.sensor_linear_acceleration));
//			break;
		case Sensor.TYPE_MAGNETIC_FIELD:
			name.append(context.getString(R.string.sensor_magnetic_field));
			break;
		case Sensor.TYPE_ORIENTATION:
			name.append(context.getString(R.string.sensor_orientation));
			break;
		case Sensor.TYPE_PRESSURE:
			name.append(context.getString(R.string.sensor_pressure));
			break;
		case Sensor.TYPE_PROXIMITY:
			name.append(context.getString(R.string.sensor_proximity));
			break;
//		case Sensor.TYPE_ROTATION_VECTOR:
//			name.append(context.getString(R.string.sensor_rotation_vector));
//			break;
		case Sensor.TYPE_TEMPERATURE:
			name.append(context.getString(R.string.sensor_temperature));
			break;

		default:
			name.append(context.getString(R.string.contentText_unknown_sensor));
			break;
		}
		return name.toString();
	}

	public static String sensor2mode(int type, Context context) {
		StringBuffer mode = new StringBuffer("");
		switch (type) {
		case Sensor.TYPE_ACCELEROMETER:
			mode.append(context.getString(R.string.mode_accelerometer));
			break;
		case Sensor.TYPE_LIGHT:
			mode.append(context.getString(R.string.mode_light));
			break;
		case Sensor.TYPE_PROXIMITY:
			mode.append(context.getString(R.string.mode_proximity));
			break;

		default:
			break;
		}
		return mode.toString();
	}
	
}
